package com.smh.a04DateUtilDemo4;

import java.time.LocalDate;
import java.time.Period;

public class PeriodDemo1 {
    public static void main(String[] args) {

        LocalDate today = LocalDate.now();
        System.out.println(today);

        LocalDate bir = LocalDate.of(2004,10,26);
        System.out.println(bir);
        //时间间隔对象
        //第二个参数见第一个参数
        Period period = Period.between(bir,today);

        System.out.println(period);
        System.out.println(period.getYears());
        System.out.println(period.getMonths());
        System.out.println(period.getDays());
        //总共多少月
        System.out.println(period.toTotalMonths());

    }
}
